interface ClockInterface {
    name:string,
    age?:number,
    readonly sex:string,

}
class Greeter implements ClockInterface{
    name:string
    greeting: string
    age:number
    sex:string
    eat:(can:string)=>void
    constructor(message: string,name:string,age:number,sex:string) {
        this.greeting = message;
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.eat = (can)=>{
            console.log(can)
        }
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}

let greeter = new Greeter("world",'dfv',95,'男');



function unip(str:string){
    let newStr:string =''
    str.split('').forEach((item,index)=>{
        let count:number = 0
        for(let i = 0 ;i <newStr.length; i++){
            if(newStr.split('')[i]==item){
                count++
            }
        }
        if(count == 0){
            newStr+=item
        }
    })
    return newStr
}
console.log(unip('asdasdaddfgbis'))

function More<T>(arg:any){
    let count:number = 0
    let ming:number = 0
    for(let i = 0 ;i <arg.length; i++){
        jisuan(arg,arg[i])
    }
    function jisuan(arg:number[],num2:number){
        let count1:number = 0
        for(let j = 0 ;j <arg.length; j++){
            if(arg[j] == num2){
                count1++
            }
        }
        if(count<count1){
            ming=num2
            count = count1
        }
    }
    return {
        name:ming,
        count2:count
    }
}
let thisMore = More<number[]>([1,2,3,4,5,8,9,7,8,8,8,5,8])
console.log(thisMore)



function findLongestWord(str:string){
    let longdc:string = ''
    str.split(' ').forEach((item,index)=>{
     //  let longLength:number = 0 
       if(item.length>longdc.length){
           longdc = item
       }
    })
    return {
        name:longdc,
        long:longdc.length
    }

}
console.log(findLongestWord('The quick brown fox jumped over the lazy dog believe'))